package io.renren.modules.erp.service;

import com.baomidou.mybatisplus.extension.service.IService;
import io.renren.common.utils.PageUtils;
import io.renren.modules.erp.entity.DepotHead;
import io.renren.modules.erp.vo.DepotHeadVo4List;
import io.renren.modules.erp.vo.DepotHeadVo4StatementAccount;

import javax.servlet.http.HttpServletRequest;
import java.math.BigDecimal;
import java.util.List;
public interface DepotHeadService extends IService<DepotHead> {
    DepotHead getDepotHead(long id)throws Exception ;
    PageUtils select2(String type, String subType, String roleType, String number, String beginTime, String endTime,
                      String materialParam, String depotIds, int currPage, int pageSize,Long userId,String payType,String status,String transportType,String serviceType,String userName,String deliverDate,String billType,String salesDate,String stockType,String deliveryType,String deliveryBillNo,String salesBillNo,String externalNumber,String organName)throws Exception ;

    PageUtils select(String type, String subType, String roleType, String number, String beginTime, String endTime,
                     String materialParam, String depotIds, int currPage, int pageSize,Long userId,String payType,String status,String transportType,String serviceType,String userName,String deliverDate,String billType,String salesDate,String stockType,String deliveryType,String deliveryBillNo,String salesBillNo,String externalNumber,String buyer,String purchaseStockBillNo,String purchaseSalesBillNo,String organName,String accountSalesBillno)throws Exception ;
    //调拨单
    PageUtils getTransferList(String type, String subType, String roleType, String number, String beginTime, String endTime,
                     String materialParam, String depotIds, int currPage, int pageSize,Long userId,String status)throws Exception ;

    //盘点单
    PageUtils getCheckList(String type, String subType, String roleType, String number, String beginTime, String endTime,
                              String materialParam, String depotIds, int currPage, int pageSize,Long userId,String status,String checkStatus,String depotId)throws Exception ;



    PageUtils selectOrderProduct(int currPage, int pageSize,String createTime,String orderSn,String memberUsername,String receiverName,String receiverPhone, String status,String isOrderNumber)throws Exception ;


    PageUtils selectReturnOrderProduct(int currPage, int pageSize,String createTime,String orderSn,String serviceNumber,String memberCompany,String receiveMan,String status,String type,String isReturnNumber,String receivePhone)throws Exception ;


    PageUtils selectByServiceNumber(int currPage, int pageSize,String serviceNumber)throws Exception ;

    PageUtils selectByOrderSn(int currPage, int pageSize,String orderSn)throws Exception ;


    Long countDepotHead(String type, String subType, String roleType,String number, String beginTime, String endTime,
                        String materialParam, String depotIds,Long userId) throws Exception;

    String[] getCreatorArray(String roleType,Long userId) throws Exception ;
    String getCreatorByRoleType(String roleType,Long userId) throws Exception;

    int insertDepotHead(String beanJson, HttpServletRequest request)throws Exception ;

//    void insertSellOrder(String defaultNumbers,Long userId)throws Exception ;

    int updateDepotHead(String beanJson, Long id, HttpServletRequest request) throws Exception;
    int deleteDepotHead(Long id, HttpServletRequest request)throws Exception;

    int batchDeleteDepotHead(String ids, HttpServletRequest request)throws Exception ;

    int checkIsNameExist(Long id, String name)throws Exception ;

    int batchSetStatus(String status, String depotHeadIDs,String type)throws Exception ;


    int checkSetStatus(String checkStatus, Long depotHeadID,String depotItemIds)throws Exception ;


    String buildOnlyNumber()throws Exception;
    String findMaterialsListByHeaderId(Long id)throws Exception;
    PageUtils findByAll(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId, Integer currPage, Integer pageSize) throws Exception;
    int findByAllCount(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId) throws Exception;
    PageUtils findInOutMaterialCount(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId, Integer offset, Integer rows)throws Exception ;
    int findInOutMaterialCountTotal(String beginTime, String endTime, String type, Integer pid, String dids, Integer oId)throws Exception;

    List<DepotHeadVo4StatementAccount> findStatementAccount(String beginTime, String endTime, Integer organId, String supType, Integer offset, Integer rows)throws Exception ;

    int findStatementAccountCount(String beginTime, String endTime, Integer organId, String supType) throws Exception;
    BigDecimal findAllMoney(Integer supplierId, String type, String subType, String mode, String endTime)throws Exception ;
    BigDecimal allMoney(String getS, String type, String subType, String mode, String endTime) ;
    BigDecimal findTotalPay(Integer supplierId, String endTime, String supType) ;
    List<DepotHeadVo4List> getDetailByNumber(String number)throws Exception ;
    void addDepotHeadAndDetail(String beanJson, String rows, Long tenantId,
                               HttpServletRequest request,Long userId) throws Exception ;

    void addTransferAndDetail(String beanJson, String rows, Long tenantId,
                               HttpServletRequest request,Long userId) throws Exception ;


    void addModalShiftAndDetail(String beanJson, String rows, Long tenantId,
                              HttpServletRequest request,Long userId) throws Exception ;


    void addCheckAndDetail(String beanJson, String rows, Long tenantId,
                                HttpServletRequest request,Long userId) throws Exception ;

    void updateDepotHeadAndDetail(Long id, String beanJson, String rows,
                                  BigDecimal preTotalPrice, Long tenantId,HttpServletRequest request,Long userId)throws Exception ;

    void updateTransferAndDetail(Long id, String beanJson, String rows,
                                  BigDecimal preTotalPrice, Long tenantId,HttpServletRequest request,Long userId)throws Exception ;

    void updateModalShiftAndDetail(Long id, String beanJson, String rows,
                                 BigDecimal preTotalPrice, Long tenantId,HttpServletRequest request,Long userId)throws Exception ;


    void updateCheckAndDetail(Long id, String beanJson, String rows,
                                   BigDecimal preTotalPrice, Long tenantId,HttpServletRequest request,Long userId)throws Exception ;


    void deleteDepotHeadAndDetail(Long id, HttpServletRequest request,Long userId,Long tenantId) throws Exception ;
    void batchDeleteDepotHeadAndDetail(String ids, HttpServletRequest request,Long userId,Long tenantId) throws Exception;
    int batchDeleteDepotHeadByIds(String ids,Long userId)throws Exception ;
    BigDecimal getBuyAndSaleStatistics(String type, String subType, Integer hasSupplier, String beginTime, String endTime);
    BigDecimal getBuyAndSaleRetailStatistics(String type, String subType, Integer hasSupplier, String beginTime, String endTime) ;
    }
